
<template>
  <div id="main">
    <header class="header">
      <div class="title">
        <img src="../../assets/images/01_11.png" @click="getBack" alt class="img_zuo" />
        <div>点位巡查</div>
      </div>
    </header>
    <div id="ditu"></div>

    <div class="panel">
    	<div class="panel-item">
    		<div class="left">街道</div>
    		<div class="right"><input class="jdmc" type="text" name="jdmc" placeholder="" readonly="readonly" v-model="jdsqObj.jd_mc" /></div>
    	</div>
    	<div class="panel-item">
    		<div class="left">社区</div>
    		<div class="right"><input class="sqmc" type="text" name="sqmc" placeholder="" readonly="readonly" v-model="jdsqObj.sq_mc" /></div>
    	</div>
    	<div class="panel-item">
    		<div class="left">巡查名称</div>
    		<div class="right"><input class="mc" type="text" v-model="title" name="mc" placeholder="" readonly="readonly" /></div>
    	</div>
    	<div class="panel-item">
    		<div class="left">类别</div>
    		<div class="right"><input class="lb" type="text" name="lb" placeholder="" readonly="readonly" v-model="lbmc" /></div>
    	</div>
    	<div class="day-selector">
    		<div v-for="(day,index) of days" :key="index" class="day-item" :class="{'active':day.active}">{{day.mc}}</div>
    	</div>
    	<div class="date-piker">
    		<span class="date-wz">开始时间&nbsp;</span>
    		<button id="qdate"><span>{{time1}}</span><img src="../../assets/images/dwxc/sj.png" class="rq_img1"></button>
    		<div class="line">——</div>
    		<button id="zdate"><span>{{time2}}</span><img src="../../assets/images/dwxc/sj.png" class="rq_img1"></button>
    	</div>
    	<div class="date-piker">
    		<span class="date-wz">结束时间&nbsp;</span>
    		<button id="qdate1"><span>{{time3}}</span><img src="../../assets/images/dwxc/sj.png" class="rq_img1"></button>
    		<div class="line">——</div>
    		<button id="zdate1"><span>{{time4}}</span><img src="../../assets/images/dwxc/sj.png" class="rq_img1"></button>
    	</div>
    	<div class="btns">
    		<div class="btn btn-zjdw" @click="toAddNew">增加点位</div>
    		<div class="btn btn-ggdw" @click="ToGgdw">更改点位</div>
    		<div class="btn btn-xgsz" @click="ToXgsz">修改设置</div>
    	</div>
    </div>

    <div class="tk zjdw-tk" v-show="tk_type == 'zjdw'">
    	<div class="bg" @click="closeTk"></div>
    	<div class="tk-box">
    		<div class="tk-item">
    			<div class="left">增加点位</div>
    			<div class="right">
    				<img class="close" @click="closeTk" src="../../assets/images/dwxc/tk_x.png" />
    			</div>
    		</div>
    		<div class="tk-item option">
    			<div class="left">点位顺序</div>
    			<div class="right"><input type="number" class="xh" v-model="zjdwObj.xh" /></div>
    		</div>
    		<div class="tk-item option">
    			<div class="left">点位名称</div>
    			<div class="right"><input type="text" class="address" v-model="zjdwObj.address" /></div>
    		</div>
    		<div class="tk-btns">
    			<div class="tk-btn" @click="addNewSub">确定</div>
    		</div>
    	</div>
    </div>


    <div class="tk ggdw-tk" v-show="tk_type=='ggdw'">
    	<div class="bg" @click="closeTk"></div>
    	<div class="tk-box">
    		<div class="tk-item">
    			<div class="left">更改点位</div>
    			<div class="right">
    				<img class="close" @click="closeTk" src="../../assets/images/dwxc/tk_x.png" />
    			</div>
    		</div>
    		<div class="tk-item option" v-for="(item,index) of dwxx_list" :key="index" @click="toGgdwxx(index)">
    			<div class="left"><img src="../../assets/images/dwxc/dwpc_19.gif" /><span>{{item.address}}</span></div>
    			<div class="right"><img src="../../assets/images/appa_r.png" /></div>
    		</div>
    	</div>
    </div>
    <div class="tk ggdwxx-tk" v-show="tk_type=='ggdwxx'">
    	<div class="bg"></div>
    	<div class="tk-box">
    		<div class="tk-item">
    			<div class="left">更改点位</div>
    			<div class="right">
    				<img class="close" @click="closeTk" src="../../assets/images/dwxc/tk_x.png" />
    			</div>
    		</div>
    		<div class="tk-item option">
    			<div class="left">点位顺序</div>
    			<div class="right"><input type="number" class="xh" v-model="ggdwObj.xh"/></div>
    		</div>
    		<div class="tk-item option">
    			<div class="left">点位名称</div>
    			<div class="right"><input type="text" class="address" v-model="ggdwObj.address"/></div>
    		</div>
    		<div class="tk-btns">
    			<div class="tk-btn btn-qrxg" @click="subGxdwxx">确认修改</div>
    		</div>
    		<div class="tk-btns">
    			<div class="tk-btn btn-show-del" @click="toDelete">删除点位</div>
    			<div class="tk-btn btn-gxdw" @click="updateDw">更新点位</div>
    		</div>
    	</div>
    </div>

    <div class="tk no-del-tk top_tk" v-show="top_tk_type=='no-del-tk'">
    	<div class="bg"></div>
    	<div class="tk-box">
    		<div class="tk-item">
    			<div class="left">提示</div>
    			<div class="right">
    				<img class="close" @click="closeTk" src="../../assets/images/dwxc/tk_x.png" />
    			</div>
    		</div>
    		<div class="tk-item">
    			<div class="tk-nr">巡查线路至少需要有一个点位，如点位有误需修改请操作更新点位。</div>
    		</div>

    	</div>
    </div>

    <div class="tk del-tk top_tk" v-show="top_tk_type=='del-tk'">
    	<div class="bg"></div>
    	<div class="tk-box">
    		<div class="tk-item">
    			<div class="left">提示</div>
    			<div class="right">
    				<img class="close" @click="closeTk" src="../../assets/images/dwxc/tk_x.png" />
    			</div>
    		</div>
    		<div class="tk-item">
    			<div class="tk-nr">是否确认删除该点位？该点位已有巡查记录，删除之后记录会保留。</div>
    		</div>
    		<div class="tk-btns">
    			<div class="tk-btn btn-qxdel" @click="closeTk">取消</div>
    			<div class="tk-btn btn-del" @click="deleteDw">确定</div>
    		</div>

    	</div>
    </div>

    <div class="tk xgsz-tk" v-show="tk_type=='xgsz'">
    	<div class="bg" @click="closeTk"></div>
    	<div class="tk-box">
    		<div class="tk-item">
    			<div class="left">修改设置</div>
    			<div class="right">
    				<img class="close" @click="closeTk" src="../../assets/images/dwxc/tk_x.png" />
    			</div>
    		</div>
    		<div class="tk-item option">
    			<div class="left">名称</div>
    			<div class="right"><input type="text" v-model="xgszObj.title"/></div>
    		</div>
    		<div class="tk-item option" id="lb">
    			<div class="left">类别</div>
    			<div class="right" @click="toSelectLb">
            <input type="text" class="lb" readonly="readonly" v-show="xgszObj.lbmc||xgszObj.lbmc===0" v-model="xgszObj.lbmc"/>
            <input type="text" class="lb" readonly="readonly" v-show="!(xgszObj.lbmc||xgszObj.lbmc===0)" value="请选择"/>
            <img src="../../assets/images/appa_r.png" /></div>
    		</div>
    		<div class="day-selector">
    			<div v-for="(day,index) of xgszDays" :key="index" class="day-item" :class="{'active':day.active}" @click="checkedDay(index)">{{day.mc}}</div>
    		</div>
    		<div class="date-piker">
    			<span class="date-wz">开始时间&nbsp;</span>
    			<button id="qdate" @click="clickDate('qdate')"><span>{{xgszObj.time1}}</span><img src="../../assets/images/dwxc/sj.png" class="rq_img1"></button>
    			<div class="line">——</div>
    			<button id="zdate" @click="clickDate('zdate')"><span>{{xgszObj.time2}}</span><img src="../../assets/images/dwxc/sj.png" class="rq_img1"></button>
    		</div>
    		<div class="date-piker">
    			<span class="date-wz">结束时间&nbsp;</span>
    			<button id="qdate1" @click="clickDate('qdate1')"><span>{{xgszObj.time3}}</span><img src="../../assets/images/dwxc/sj.png" class="rq_img1"></button>
    			<div class="line">——</div>
    			<button id="zdate1" @click="clickDate('zdate1')"><span>{{xgszObj.time4}}</span><img src="../../assets/images/dwxc/sj.png" class="rq_img1"></button>
    		</div>
    		<div class="tk-btns">
    			<div class="tk-btn btn-xgsz-qrxg" @click="subXgsz">确认修改</div>
    		</div>
    	</div>
    </div>

    <div class="tk lb-tk top_tk" v-show="top_tk_type=='lb-tk'">
    	<div class="bg"></div>
    	<div class="tk-box">
    		<div class="tk-item">
    			<div class="left">请选择</div>
    			<div class="right">
    				<img class="close" @click="closeTk" src="../../assets/images/dwxc/tk_x.png" />
    			</div>
    		</div>
        <div class="tk-item option" v-for="(v,index) of lb_list" :key="index" @click="checkType(index)">
          <div class="left">{{v.mc}}</div>
          <div class="right"></div>
        </div>
    	</div>
    </div>

    <van-popup v-model="btm_show" position="bottom">
      <van-datetime-picker v-model="currentTime" type="time" @confirm="confirm_picker" @cancel="cancel_picker" />
    </van-popup>

  </div>
</template>
<script>
	import { Dialog } from "vant";
  import qs from 'qs';
  import utils from "../../assets/js/utils.js"
  import terminal from "../../assets/js/terminal";
  export default {
    name: "dwxc_6",
    data() {
      return {
        map:null,
        markers:[],
        polylineArr:[],
        userMarker:null,
        days:[],
        xgszDays:[],
        time1:null,
        time2:null,
        time3:null,
        time4:null,
        currentTime: '',
        currentTimeType:'',
        btm_show: false,//是否显示底部弹框
        jdsqObj:{},
        lb_list: [],
        lbmc:'',
        lbid:'',
        title:'',
        doing:false,
        dwxx_list:[],
        tk_type:'',
        top_tk_type:'',
        zjdwObj:{},
        xgszObj:{},
        ggdwObj:{},
        dataId:null,//点位巡查信息id
        terminal: false,
        add_timer:null,
        xgdw_timer:null,
        mark_timer:null,
        user_timer:null
      };
    },
    methods: {
        getBack () {//返回
          // this.$router.push('/dwxc_2_Pointcreation');
          this.$router.back()
        },
        createMap(){//创建地图
          var _this = this;
          _this.map = new AMap.Map('ditu',{
          	zoomEnable: true, //地图是否可缩放，默认值为true
          });
          // 传入经纬度，设置地图中心点
          //渝中区106.57,29.55
          //杨家坪106.512339,29.505386
          var position = new AMap.LngLat(_this.$global_msg.centerJwd.jd,_this.$global_msg.centerJwd.wd);  // 标准写法
          _this.map.setCenter(position);
          // 设置地图级别，级别为数字。
          // PC上，参数zoom可设范围：[3,18]；
          // 移动端：参数zoom可设范围：[3,19]
          _this.map.setZoom(15);

          //地图点击事件
          _this.map.on('click', function(ev) {
          	// 触发事件的对象
            var target = ev.target;
            // 触发事件的地理坐标，AMap.LngLat 类型
            var lnglat = ev.lnglat;
            // 触发事件的像素坐标，AMap.Pixel 类型
            var pixel = ev.pixel;
            // 触发事件类型
            var type = ev.type;

            //清楚所有标点
            // for(var n=0;n<_this.markers.length;n++){
            //   _this.map.remove(_this.markers[n]);
            // }

            /*if (_this.markers.length > 0) {
            	var list = [];
            	for (var n = 0; n < _this.markers.length; n++) {
            		list.push([_this.markers[n].jwdObj.jd,_this.markers[n].jwdObj.wd]);
            	}
              var flag = _this.checkJuli(list,lnglat);
              if(flag){
                var obj = {
                  jwd:lnglat.lng+','+lnglat.lat
                };
                //创建标点
                _this.biaodian(obj);
              }else{
                _this.$toast('两个点距离过近');
              }
            } else {
            	var obj = {
            	  jwd:lnglat.lng+','+lnglat.lat
            	};
              //创建标点
              _this.biaodian(obj);
            }*/

          });
          _this.startGeolocation();
        },
        startGeolocation(){//开始定位
          var _this = this;
          clearInterval(_this.geolocation_timer);
          _this.geolocation_timer = null;
          _this.map.plugin('AMap.Geolocation', function() {
              var geolocation = new AMap.Geolocation({
                  // 是否使用高精度定位，默认：true
                  enableHighAccuracy: true,
                  // 设置定位超时时间，默认：无穷大
                  //timeout: 10000,
                  // 定位按钮的停靠位置的偏移量，默认：Pixel(10, 20)
                  //buttonOffset: new AMap.Pixel(10, 20),
                  //  定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
                  //zoomToAccuracy: false,
                  //  定位按钮的排放位置,  RB表示右下
                  //buttonPosition: 'RB'
               })

              // 监听获取位置信息成功的回调函数
              AMap.event.addListener(geolocation, 'complete', onComplete);
              // 监听获取位置信息错误的回调函数
              AMap.event.addListener(geolocation, 'error', onError);

              function usePosition(lng,lat){
                var position = {};
                if(_this.terminal !== true){
                  position = utils.getGpsPosition(lng,lat);
                }else{
                  position = new AMap.LngLat(lng,lat);
                }
                if(_this.userMarker){
                  _this.userMarker.setPosition(position);
                  _this.map.setCenter(position);
                }else{
                  //创建标点
                  _this.markUser(position);
                }
              }

              function onComplete (data) {
                usePosition(data.position.lng,data.position.lat);
              }

              function onError (error) {
                  // 定位出错
                  //console.log(error)
                  if(error.message=='Geolocation permission denied.'){
                    //_this.tishiDw();
                  }
                  utils.getPosition(function(lng,lat){
                    console.log('切换使用sdk获取定位成功:'+lng+','+lat);
                    usePosition(lng,lat);
                  },function(msg){
                    console.log('获取定位错误:'+msg);
                  });
              }

              function startGetDw(){
                plus.geolocation.getCurrentPosition(function(p) {
                  geolocation.getCurrentPosition();
                  _this.geolocation_timer =  setInterval(function(){
                    // 获取当前位置信息
                    geolocation.getCurrentPosition();
                  },1000);
                }, function(e) {
                	_this.tishiDw();
                });
              }
              if(plus){
              	startGetDw();
              }else{
              	document.addEventListener('plusready',function(){
                  startGetDw();
                },false);
              }

              // 自动适配到合适视野范围
              // 无参数，默认包括所有覆盖物的情况
              _this.map.setFitView();
          })
        },
        tishiDw(){
          var _this = this;
          var isAndroid = terminal.terminals().android;
          Dialog.confirm({
            title: '提示',
            message: '请打开定位',
            confirmButtonText: "去设置", //改变确认按钮上显示的文字
            cancelButtonText: "取消" //改变取消按钮上显示的文字
          }).then(() => {
            //console.log("点击了确认按钮噢")
            if(isAndroid){//安卓系统
              var main = plus.android.runtimeMainActivity();
              var Intent = plus.android.importClass("android.content.Intent");
              var mIntent = new Intent('android.settings.LOCATION_SOURCE_SETTINGS');
              main.startActivity(mIntent);
            }else{//IOS系统
              var UIApplication = plus.ios.import("UIApplication");
              var NSURL = plus.ios.import("NSURL");
              var setting = NSURL.URLWithString("app-settings:");
              var application = UIApplication.sharedApplication();
              application.openURL(setting);
              plus.ios.deleteObject(setting);
              plus.ios.deleteObject(application);
            }
          }).catch(() => {
            //console.log("点击了取消按钮噢")
          });
          _this.stopGeolocation();
        },
        stopGeolocation(){//停止定位
          clearInterval(this.geolocation_timer);
          clearInterval(this.add_timer);
          clearInterval(this.xgdw_timer);
          clearInterval(this.mark_timer);
          clearInterval(this.user_timer);
          this.geolocation_timer = null;
          this.add_timer = null;
          this.xgdw_timer = null;
          this.mark_timer = null;
          this.user_timer = null;
        },
        markUser(lnglat){//用户标点
          var _this = this;
          var img_url = require('../../assets/images/dwxc/dwpc_25.gif');
          var content = '';
          content+='<div class="user" style="text-align:center;margin-top:0.462962rem;">';
          	content+='<img style="width: 0.379629rem;height: 0.462962rem;" src="'+img_url+'"/>';
          content+='</div>';
          // 创建一个 Marker 实例：
          var marker = new AMap.Marker({
          	position: lnglat,// 经纬度对象，也可以是经纬度构成的一维数组[116.39, 39.9]
          	//title: '标点',
          	content: content,
            zIndex:11
          });
          // 设置点标记的动画效果，此处为弹跳效果
          //marker.setAnimation('AMAP_ANIMATION_BOUNCE');
          // 将创建的点标记添加到已有的地图实例：
          //marker.dataObj = obj;
          _this.map.add(marker);
          _this.userMarker = marker;
          _this.map.setCenter(lnglat);
        },
        biaodian(obj){//标点
          var _this = this;
          var img_url = require('../../assets/images/dwxc/dwpc_19.gif');

          var content = '';
          content+='<div style="text-align:center;margin-top:0.11044658064516133rem;margin-left: -0.1111rem;">';
          	content+='<img style="width: 0.6019rem;height:0.8154774193548386rem;" src="'+img_url+'"/>';
            content += '<div>' + obj.address+'('+obj.xh+')' + '</div>'
            //content+='<div style="position: absolute;bottom: 0;white-space: nowrap;font-size: 0.333333rem;top: 0.231481rem;left: 0.385rem;">'+obj.address+'('+obj.xh+')'+'</div>';
          content+='</div>';
          // 创建一个 Marker 实例：
          var lnglat = obj.jwd.split(',');
          var marker = new AMap.Marker({
          	position: lnglat,// 经纬度对象，也可以是经纬度构成的一维数组[116.39, 39.9]
          	//title: '标点',
          	content: content,
            zIndex:10
          });
          // 设置点标记的动画效果，此处为弹跳效果
          //marker.setAnimation('AMAP_ANIMATION_BOUNCE');
          // 将创建的点标记添加到已有的地图实例：
          marker.dataObj = obj;
          marker.jwdObj = {
            jd:lnglat[0],
            wd:lnglat[1]
          };
          _this.map.add(marker);
          _this.markers.push(marker);
          //_this.map.setFitView();

          if (_this.markers.length > 1) {
          	// 折线的节点坐标数组，每个元素为 AMap.LngLat 对象
            var jd = _this.markers[_this.markers.length - 2].jwdObj.jd;
            var wd = _this.markers[_this.markers.length - 2].jwdObj.wd;
            var path = [
                new AMap.LngLat(jd,wd),
                new AMap.LngLat(lnglat[0],lnglat[1])
            ];
            // 创建折线实例
            var polyline = new AMap.Polyline({
                path: path,
                borderWeight: 2, // 线条宽度，默认为 1
                strokeColor: '#ffb400', // 线条颜色
                lineJoin: 'round' // 折线拐点连接处样式
            });

            // 将折线添加至地图实例
            _this.map.add(polyline);
            _this.polylineArr.push(polyline);

          }
          // 自动适配到合适视野范围
          // 无参数，默认包括所有覆盖物的情况
          _this.map.setFitView();

        },
        toAddNew(){//底部的增加点位按钮
          var _this = this;
          var max_xh = 1;
          if(_this.dwxx_list.length){
            max_xh = (_this.dwxx_list[_this.dwxx_list.length - 1].xh * 1) + 1;
          }
          _this.zjdwObj = {
            xh:max_xh,
            address:'',
            max_xh:max_xh
          };
          _this.tk_type = 'zjdw';
          _this.$forceUpdate();

          _this.doing = true;
          setTimeout(function(){
            _this.doing = false;
          },100);
        },
        addNewSub(){//增加点位确定按钮
          var _this = this;

          _this.add_timer = setInterval(function(){
            if(_this.userMarker){
              clearInterval(_this.add_timer);
              _this.add_timer = null;

              var flag = false;
              var position = _this.userMarker.getPosition();
              if (_this.dwxx_list.length > 0) {
              	var list = [];
              	for (var n = 0; n < _this.dwxx_list.length; n++) {
                  if(_this.dwxx_list[n].jwd){
                    var jwdObj = _this.dwxx_list[n].jwd.split(',');
                    list.push([jwdObj[0],jwdObj[1]]);
                  }
              	}
                flag = _this.checkJuli(list,position);
              }else{
                flag = true;
              }
              if(flag){
                _this.zjdwObj.jwd = position.lng+','+position.lat;
                _this.editDw('add',_this.zjdwObj);
              }else{
                _this.$toast('两个点距离过近');
                try{
                  plus.nativeUI.closeWaiting();
                }catch(e){
                  console.log(e.message);
                }
              }
            }
          },100);
        },
        ToXgsz(){
          var _this = this;
          if(_this.days.length>0){
            _this.xgszDays = JSON.parse(JSON.stringify(_this.days));
            for(var n=0;n<_this.xgszDays.length;n++){
              _this.xgszDays[n].active = false;
            }
            for(var n=0;n<_this.xgszDays.length;n++){
              _this.days.forEach(v=>{
                if(v.dataid===_this.xgszDays[n].dataid&&v.active){
                  _this.xgszDays[n].active = true;
                }
              });
            }
          }else{
            _this.xgszDays = [];
          }
          _this.xgszObj = {
            title:_this.title,
            lbid:_this.lbid,
            lbmc:_this.lbmc,
            time1:_this.time1,
            time2:_this.time2,
            time3:_this.time3,
            time4:_this.time4
          };
          _this.tk_type = 'xgsz';
          _this.$forceUpdate();

          _this.doing = true;
          setTimeout(function(){
            _this.doing = false;
          },100);
        },
        subXgsz(){
          var _this = this;
          _this.editDw('modifySettings',_this.xgszObj);
        },
        toSelectLb(){
          var _this = this;
          _this.top_tk_type = 'lb-tk';
          _this.$forceUpdate();

          _this.doing = true;
          setTimeout(function(){
            _this.doing = false;
          },100);
        },
        checkType(index){
          if(this.doing){
            return;
          }
          this.xgszObj.lbid = this.lb_list[index].id;
          this.xgszObj.lbmc = this.lb_list[index].mc;
          this.closeTk();
        },
        ToGgdw(){
          var _this = this;
          _this.tk_type = 'ggdw';
          _this.$forceUpdate();

          _this.doing = true;
          setTimeout(function(){
            _this.doing = false;
          },100);
        },
        toGgdwxx(index){
          var _this = this;
          var max_xh = 1;
          if(_this.dwxx_list.length){
            max_xh = (_this.dwxx_list[_this.dwxx_list.length - 1].xh * 1) + 1;
          }
          _this.ggdwObj = JSON.parse(JSON.stringify(_this.dwxx_list[index]));
          _this.ggdwObj.max_xh = max_xh;
          _this.ggdwObj.index = index;
          _this.tk_type = 'ggdwxx';
          _this.$forceUpdate();

          _this.doing = true;
          setTimeout(function(){
            _this.doing = false;
          },100);
        },
        subGxdwxx(){
          var _this = this;
          _this.editDw('updateDwInfo',_this.ggdwObj);
        },
        updateDw(){
          var _this = this;
          if (_this.doing == true) {
          	return;
          }

          try{
            plus.nativeUI.showWaiting("正在加载...");
          }catch(e){
            console.log(e.message);
          }

          _this.xgdw_timer = setInterval(function(){
            if(_this.userMarker){
              clearInterval(_this.xgdw_timer);
              _this.xgdw_timer = null;

              var flag = false;
              var position = _this.userMarker.getPosition();
              if (_this.dwxx_list.length > 0) {
              	var list = [];
              	for (var n = 0; n < _this.dwxx_list.length; n++) {
                  if(_this.dwxx_list[n].jwd){
                    var jwdObj = _this.dwxx_list[n].jwd.split(',');
                    list.push([jwdObj[0],jwdObj[1]]);
                  }
              	}
                flag = _this.checkJuli(list,position);
              }else{
                flag = true;
              }
              if(flag){
                _this.ggdwObj.jwd = position.lng+','+position.lat;
                _this.editDw('updateDwJwd',_this.ggdwObj);
              }else{
                _this.$toast('两个点距离过近');
                try{
                  plus.nativeUI.closeWaiting();
                }catch(e){
                  console.log(e.message);
                }
              }
            }
          },100);
        },
        toDelete(){
          var _this = this;
          _this.top_tk_type = 'del-tk';
          _this.$forceUpdate();

          _this.doing = true;
          setTimeout(function(){
            _this.doing = false;
          },100);
        },
        deleteDw(){
          if(this.doing){
            return;
          }
          var _this = this;
          if(_this.dwxx_list.length==1){
            _this.top_tk_type = 'no-del-tk';
            _this.$forceUpdate();

            _this.doing = true;
            setTimeout(function(){
              _this.doing = false;
            },100);
          }else{
            try{
              plus.nativeUI.showWaiting("正在加载...");
            }catch(e){
              console.log(e.message);
            }
            var params = {
              spotInspectionLocationDataId:_this.ggdwObj.SpotInspection_location_dataid
            };
            console.log(params);
            _this.doing == true;
            _this.axios.get(_this.$global_msg.Url.host + "/DotPlacePatrol/deleteSpotInspectionLocation",{params}).then(function (data) {
              try{
                plus.nativeUI.closeWaiting();
              }catch(e){
                console.log(e.message);
              }
              console.log('/DotPlacePatrol/deleteSpotInspectionLocation:',data);
              if(data&&data.data){
                if(data.data.code==200){
                  _this.$toast({
                    message: '删除成功',
                    forbidClick:true,
                    onClose: () => {
                      _this.init();
                    }
                  })
                }else{
                  _this.$toast(data.data.msg);
                  _this.doing == false;
                }
              }else{
                _this.$toast('删除失败');
                _this.doing == false;
              }
            }).catch(err=>{
              this.$terminal._error(err)
          })
          }
        },
        checkJuli(list,one){
          var keyi_num = 0;
          for(var n=0;n<list.length;n++){
            var dis = AMap.GeometryUtil.distance(list[n], one);
            if(dis>5){
              keyi_num++;
            }
          }
          if (keyi_num === list.length) {
          	return true;
          } else {
          	return false;
          }
        },
        closeTk(){
          if(this.doing){
            return;
          }

          if(this.checkNull(this.top_tk_type)){
            if(this.tk_type == 'zjdw'){
              this.zjdw = {};
              this.tk_type = '';
            }else if(this.tk_type == 'xgsz'){
              this.xgszObj = {};
              this.tk_type = '';
            }else if(this.tk_type == 'ggdw'){
              this.tk_type = '';
            }else if(this.tk_type == 'ggdwxx'){
              this.ggdwObj = {};
              this.tk_type = 'ggdw';
            }
          }else{
            this.top_tk_type = '';
          }
          this.$forceUpdate();
        },
        closeAllTk(){
          if(this.doing){
            return;
          }

          this.zjdw = {};
          this.xgszObj = {};
          this.ggdwObj = {};
          this.top_tk_type = '';
          this.tk_type = '';
          this.$forceUpdate();
        },
        mark_list(list){
          var _this = this;
          _this.mark_timer = setInterval(function(){
            if(_this.map){
              clearInterval(_this.mark_timer);
              _this.mark_timer = null;
              _this.map.remove(_this.markers);
              _this.map.remove(_this.polylineArr);
              _this.markers = [];
              _this.polylineArr = [];
              for (var n = 0; n < list.length; n++) {
              	//创建标点
                _this.biaodian(list[n]);
              }
              _this.user_timer = setInterval(function(){
                if(_this.userMarker){
                  clearInterval(_this.user_timer);
                  _this.user_timer = null;
                  // 自动适配到合适视野范围
                  // 无参数，默认包括所有覆盖物的情况
                  _this.map.setFitView();
                }
              },100);
            }
          },100);
        },
        clickDate(type){
          var _this = this;
          var dtPicker = null;
          if(type=='qdate'){
            _this.currentTime = _this.xgszObj.time1?_this.xgszObj.time1:utils.dateFormat(new Date(),'HH:mm');
          }else if(type=='zdate'){
            _this.currentTime = _this.xgszObj.time2?_this.xgszObj.time2:utils.dateFormat(new Date(),'HH:mm');
          }else if(type=='qdate1'){
            _this.currentTime = _this.xgszObj.time3?_this.xgszObj.time3:utils.dateFormat(new Date(),'HH:mm');
          }else if(type=='zdate1'){
            _this.currentTime = _this.xgszObj.time4?_this.xgszObj.time4:utils.dateFormat(new Date(),'HH:mm');
          }
          _this.currentTimeType = type;
          _this.btm_show = true;
        },
        confirm_picker(){
          var _this = this;
          if(_this.currentTimeType=='qdate'){
            if (_this.xgszObj.time2 < _this.currentTime && _this.xgszObj.time2 != null) {
            	_this.$toast('不能大于开始时间的结束时间');
            	_this.xgszObj.time1 = null;
            } else if ((_this.xgszObj.time3 < _this.currentTime || _this.xgszObj.time4 < _this.currentTime) && (_this.xgszObj.time3 != null || _this.xgszObj.time4 != null)) {
            	_this.$toast('不能大于结束时间');
            	_this.xgszObj.time1 = null;
            }else{
              _this.xgszObj.time1 = _this.checkNull(_this.currentTime)?'00:00':_this.currentTime;
            }
          }else if(_this.currentTimeType=='zdate'){
            if (_this.currentTime < _this.xgszObj.time1 && _this.xgszObj.time1 != null) {
            	_this.$toast('不能小于开始时间的起始时间');
            	_this.xgszObj.time2 = null;
            } else if ((_this.xgszObj.time3 < _this.currentTime || _this.xgszObj.time4 < _this.currentTime) && (_this.xgszObj.time3 != null || _this.xgszObj.time4 != null)) {
            	_this.$toast('不能大于结束时间');
            	_this.xgszObj.time2 = null;
            }else{
              _this.xgszObj.time2 = _this.checkNull(_this.currentTime)?'00:00':_this.currentTime;
            }
          }else if(_this.currentTimeType=='qdate1'){
            if ((_this.currentTime < _this.xgszObj.time2 || _this.currentTime < _this.xgszObj.time1) && (_this.xgszObj.time2 != null || _this.xgszObj.time1 != null)) {
            	_this.$toast('不能小于开始时间');
            	_this.xgszObj.time3 = null;
            } else if (_this.currentTime > _this.xgszObj.time4 && _this.xgszObj.time4 != null) {
            	_this.$toast('不能大于结束时间终止时间');
            	_this.xgszObj.time3 = null;
            }else{
              _this.xgszObj.time3 = _this.checkNull(_this.currentTime)?'00:00':_this.currentTime;
            }
          }else if(_this.currentTimeType=='zdate1'){
            if ((_this.currentTime < _this.xgszObj.time2 || _this.currentTime < _this.xgszObj.time1) && (_this.xgszObj.time2 != null || _this.xgszObj.time1 != null)) {
            	_this.$toast('不能小于开始时间');
            	_this.xgszObj.time4 = null;
            } else if (_this.xgszObj.time3 > _this.currentTime && _this.xgszObj.time3 != null) {
            	_this.$toast('不能小于结束时间起始时间');
            	_this.xgszObj.time4 = null;
            }else{
              _this.xgszObj.time4 = _this.checkNull(_this.currentTime)?'00:00':_this.currentTime;
            }
          }
          _this.cancel_picker()
        },
        cancel_picker(){
          this.currentTime = '';
          this.currentTimeType = '';
          this.btm_show = false;
          this.$forceUpdate();
        },
        checkNull(value){//检测是否为空
          if(value||value===0||value==='0'){
            return false;
          }else{
            return true;
          }
        },
        checkedDay(index){
          this.xgszDays[index].active = !this.xgszDays[index].active;
          this.$forceUpdate();
        },
        //点位根据序号排序
        sortPoint(arr) {
        	for (var i = 0; i < arr.length - 1; i++) {
        		for (var j = 0; j < arr.length - i - 1; j++) {
        			if (arr[j].xh > arr[j + 1].xh) {// 相邻元素两两对比
        				var hand = arr[j];
        				arr[j] = arr[j + 1];
        				arr[j + 1] = hand;
        			}
        		}
        	}
        	return arr;
        },
        editDw(type,obj){
          var _this = this;
          if (_this.doing == true) {
          	return;
          }
          var params = {};
          var tishi = '';
          if(type=='add'){
            tishi = '新增';
            if(_this.checkNull(obj.xh)){
            	_this.$toast('点位顺序不能为空');
            	return;
            }
            if(obj.xh===0||obj.xh==='0'){
            	_this.$toast('点位顺序不能为0');
            	return;
            }
            if((obj.xh*1)>obj.max_xh){
            	_this.$toast('点位顺序最大为'+obj.max_xh);
            	return;
            }

            var xh_flag = false;//序号是否重复
            var add_SpotInspection_location = [];
            var update_SpotInspection_location = [];
            for (var n = 0; n < _this.dwxx_list.length; n++) {
            	if ((_this.dwxx_list[n].xh * 1) === (obj.xh * 1)) {
            		xh_flag = true;
            		add_SpotInspection_location.push({
            			xh: obj.xh,
            			address: obj.address,
            			jwd: obj.jwd
            		});
            	}
            	if (xh_flag) {
            		update_SpotInspection_location.push({
            			SpotInspection_location_dataid: _this.dwxx_list[n].SpotInspection_location_dataid,
            			xh: ((_this.dwxx_list[n].xh * 1) + 1),
            			address: _this.dwxx_list[n].address,
            			jwd: _this.dwxx_list[n].jwd
            		});
            	} else {
            		update_SpotInspection_location.push({
            			SpotInspection_location_dataid: _this.dwxx_list[n].SpotInspection_location_dataid,
            			xh: _this.dwxx_list[n].xh,
            			address: _this.dwxx_list[n].address,
            			jwd: _this.dwxx_list[n].jwd
            		});
            	}
            }
            if (!xh_flag) {
            	add_SpotInspection_location.push({
            		xh: obj.xh,
            		address: obj.address,
            		jwd: obj.jwd
            	});
            }

            params = {
            	dataId: _this.dataId, //点位巡查dataid
            	addSpotInspectionLocation: JSON.stringify(add_SpotInspection_location), //新增的点位json字符串（包含:address，xh,jwd）
            	updateSpotInspectionLocation: JSON.stringify(update_SpotInspection_location), //新增的点位json字符串（包含:address，xh,jwd）
            	editType: "updateXh" //修改设置标识
            };
          } else if (type == 'updateDwInfo') {//修改点位信息(序号、名称)
            tishi = '修改';
            if(_this.checkNull(obj.xh)){
            	_this.$toast('点位顺序不能为空');
            	return;
            }
            if(obj.xh===0||obj.xh==='0'){
            	_this.$toast('点位顺序不能为0');
            	return;
            }
            if((obj.xh*1)>obj.max_xh){
            	_this.$toast('点位顺序最大为'+obj.max_xh);
            	return;
            }
            var xh_flag = false;
            var update_SpotInspection_location = [];
            for (var n = 0; n < _this.dwxx_list.length; n++) {
              if (_this.dwxx_list[n].SpotInspection_location_dataid === obj.SpotInspection_location_dataid && (obj.xh * 1) !== (_this.dwxx_list[n].xh * 1)) {
                xh_flag = true;
              }
            }
            for (var n = 0; n < _this.dwxx_list.length; n++) {
              if (_this.dwxx_list[n].SpotInspection_location_dataid === obj.SpotInspection_location_dataid) {
                update_SpotInspection_location.push({
                  SpotInspection_location_dataid: obj.SpotInspection_location_dataid,
                  xh: (obj.xh * 1),
                  address: obj.address,
                  jwd: obj.jwd
                });
              } else {
                if ((_this.dwxx_list[n].xh * 1) >= (obj.xh * 1) && xh_flag) {
                  update_SpotInspection_location.push({
                    SpotInspection_location_dataid: _this.dwxx_list[n].SpotInspection_location_dataid,
                    xh: (_this.dwxx_list[n].xh * 1) + 1,
                    address: _this.dwxx_list[n].address,
                    jwd: _this.dwxx_list[n].jwd
                  });
                } else {
                  update_SpotInspection_location.push({
                    SpotInspection_location_dataid: _this.dwxx_list[n].SpotInspection_location_dataid,
                    xh: _this.dwxx_list[n].xh,
                    address: _this.dwxx_list[n].address,
                    jwd: _this.dwxx_list[n].jwd
                  });
                }
              }
            }
            update_SpotInspection_location = _this.sortPoint(update_SpotInspection_location);
            /*for(var n=0;n<update_SpotInspection_location.length;n++){
              update_SpotInspection_location[n].xh = n+1;
            }*/
            console.log(update_SpotInspection_location);

            params = {
              dataId: _this.dataId, //点位巡查dataid
              updateSpotInspectionLocation: JSON.stringify(update_SpotInspection_location),//新增的点位json字符串（包含:address，xh,jwd）
              editType: 'updateInfo'
            };
          } else if (type == 'updateDwJwd') {//修改点位经纬度
            tishi = '修改';
            var xh_flag = false;//序号是否重复
            var update_SpotInspection_location = [];
            update_SpotInspection_location.push({
              SpotInspection_location_dataid: obj.SpotInspection_location_dataid,
              xh: (obj.xh * 1),
              address: obj.address,
              jwd: obj.jwd
            });
            console.log(update_SpotInspection_location);
            params = {
              dataId: _this.dataId, //点位巡查dataid
              updateSpotInspectionLocation: JSON.stringify(update_SpotInspection_location),//新增的点位json字符串（包含:address，xh,jwd）
              editType: 'updatePoint'
            };
          }else if (type == 'modifySettings') {//修改设置
            tishi = '修改';
            var SpotInspection_location = ''
            for(var n=0;n<_this.xgszDays.length;n++){
              if(_this.xgszDays[n].active){
                SpotInspection_location +=  _this.xgszDays[n].dataid+'|';
              }
            }
            if (SpotInspection_location.length > 0) {
            	SpotInspection_location=SpotInspection_location.substring(0,SpotInspection_location.length-1);
            } else {
              _this.$toast('请选择日期');
              return;
            }
            if(_this.checkNull(obj.title)){
              _this.$toast('请输入名称');
              return;
            }else{
              if(obj.title.length > 10){
                _this.$toast('名称长度不能超过10个字符');
                return;
              }
            }
            if(_this.checkNull(obj.lbid)){
              _this.$toast('请选择类别');
              return;
            }
            if(_this.checkNull(obj.time1)||_this.checkNull(obj.time2)){
              _this.$toast('请选择开始时间');
              return;
            }
            if(_this.checkNull(obj.time3)||_this.checkNull(obj.time4)){
              _this.$toast('请选择结束时间');
              return;
            }

            var updateSpotInspectionLocation = [{
              lxdataid: obj.lbid//类型编号
            }];
            params = {
              dataId: _this.dataId, //点位巡查dataid
              updateSpotInspectionLocation:JSON.stringify(updateSpotInspectionLocation),
              spotInspectionDayDataid: SpotInspection_location, //点位巡查时间dataid (|隔开的数组)
              beginTime: obj.time1, //开始时间
              endTime: obj.time2, //结束时间
              beginTime1: obj.time3, //开始时间
              endTime1: obj.time4, //结束时间
              titles: obj.title,//名称
              lxdataid: obj.lbid,//类型编号
              editType: "modifySettings" //修改设置标识
            };
          }

          _this.doing == true;
          try{
            plus.nativeUI.showWaiting("正在加载...");
          }catch(e){
            console.log(e.message);
          }
          console.log(params);
          _this.axios.post(_this.$global_msg.Url.host + "/DotPlacePatrol/editSpotInspection",qs.stringify(params)).then(function (data) {
            try{
              plus.nativeUI.closeWaiting();
            }catch(e){
              console.log(e.message);
            }
            console.log('/DotPlacePatrol/editSpotInspection:',data);
            if(data&&data.data){
              if(data.data.code==200){
                _this.$toast({
                  message: tishi+'成功',
                  forbidClick:true,
                  onClose: () => {
                    _this.getDwxx();
                  }
                })
              }else{
                _this.$toast(data.data.msg);
                _this.doing == false;
              }
            }else{
              _this.$toast(tishi+'失败');
              _this.doing == false;
            }
          });
        },
        getInit(){
          var _this = this;

          _this.qy_id = null;
          _this.qy_mc = null;
          _this.time1 = null;
          _this.time2 = null;
          _this.time3 = null;
          _this.time4 = null;
          _this.title = null;
          _this.lbmc = null;
          _this.lbid = null;
          _this.jdsqObj = {};
          _this.days = [];
          _this.lb_list = [];
          _this.zjdw = {};
          _this.xgszObj = {};
          _this.ggdwObj = {};
          _this.top_tk_type = '';
          _this.tk_type = '';
          _this.doing == false;

          try{
            plus.nativeUI.showWaiting("正在加载...");
          }catch(e){
            console.log(e.message);
          }
          var params = {
            userId:_this.userId,
          };
          _this.axios.get(_this.$global_msg.Url.host + "/DotPlacePatrol/insertGetSpotInspectioPageData",{
          	params: params
          }).then(function (data) {
            try{
              plus.nativeUI.closeWaiting();
            }catch(e){
              console.log(e.message);
            }
            console.log('/DotPlacePatrol/insertGetSpotInspectioPageData:',data);
            if(data&&data.data){
              if(data.data.code==200){
                if(data.data.rows){

                  _this.days = data.data.rows.day;
                  for(var n=0;n<_this.days.length;n++){
                    _this.days[n].dataid = _this.days[n].dataid;
                  }

                  _this.lb_list = data.data.rows.type;
                  for(var n=0;n<_this.lb_list.length;n++){
                    _this.lb_list[n].id = _this.lb_list[n].dataid;
                  }

                  _this.getDwxx();
                }
              }else{
                _this.$toast(data.data.msg);
              }
            }else{
              _this.$toast('查询失败');
            }
          });
        },
        getDwxx(){
          var _this = this;

          if(_this.map){
            _this.map.remove(_this.markers);
            _this.map.remove(_this.polylineArr);
          }
          _this.markers = [];
          _this.polylineArr = [];
          _this.qy_id = null;
          _this.qy_mc = null;
          _this.time1 = null;
          _this.time2 = null;
          _this.time3 = null;
          _this.time4 = null;
          _this.title = null;
          _this.lbmc = null;
          _this.lbid = null;
          _this.jdsqObj = {};
          _this.zjdw = {};
          _this.xgszObj = {};
          _this.ggdwObj = {};
          _this.top_tk_type = '';
          _this.tk_type = '';
          _this.doing == false;
          for(var n=0;n<_this.days.length;n++){
            _this.days[n].active = false;
          }

          try{
            plus.nativeUI.showWaiting("正在加载...");
          }catch(e){
            console.log(e.message);
          }
          var params = {
            dataId:_this.dataId
          };
          _this.axios.get(_this.$global_msg.Url.host + "/DotPlacePatrol/selectSpotInspection",{
          	params: params
          }).then(function (data) {
            try{
              plus.nativeUI.closeWaiting();
            }catch(e){
              console.log(e.message);
            }
            console.log('/DotPlacePatrol/selectSpotInspection:',data);
            if(data&&data.data){
              if(data.data.code==200){
                if(data.data.rows){

                  for(var n=0;n<_this.days.length;n++){
                    data.data.rows.weekSpotInspection.forEach((v, index) => {
                      if(v.dataid===_this.days[n].dataid){
                        _this.days[n].active = true;
                      }
                    })
                  }

                  if(data.data.rows.spotInspection&&data.data.rows.spotInspection.length>0){
                    _this.jdsqObj = {
                      jd_id:data.data.rows.spotInspection[0].jdid,
                      jd_mc:data.data.rows.spotInspection[0].jdmc,
                      sq_id:data.data.rows.spotInspection[0].sqid,
                      sq_mc:data.data.rows.spotInspection[0].sqmc
                    };
                    _this.lbmc = data.data.rows.spotInspection[0].lxmc;
                    _this.lbid = data.data.rows.spotInspection[0].lxid;
                    _this.title = data.data.rows.spotInspection[0].title;
                    _this.time1 = data.data.rows.spotInspection[0].beginTime;
                    _this.time2 = data.data.rows.spotInspection[0].endTime;
                    _this.time3 = data.data.rows.spotInspection[0].beginTime1;
                    _this.time4 = data.data.rows.spotInspection[0].endTime1;
                  }
                  var dwxx_list = data.data.rows.spotInspection;
                  dwxx_list = _this.sortPoint(dwxx_list);
                  _this.dwxx_list = dwxx_list;
                  _this.mark_list(dwxx_list);
                }
              }else{
                _this.$toast(data.data.msg);
              }
            }else{
              _this.$toast('查询失败');
            }
            _this.$forceUpdate();
          });
        },
        init(){//初始化
          var _this = this;
          _this.userId = localStorage.getItem("userId"); //用户id
          _this.username = localStorage.getItem('username');
          _this.dataId = localStorage.getItem("dwxc_bj_id"); //点位巡查信息id
          _this.terminal = terminal.terminals().android;
          //_this.terminal = false;

          if(_this.map){
            if(_this.userMarker){
              _this.map.remove(_this.userMarker);
            }
            _this.userMarker = null;
            _this.startGeolocation();
            _this.map.remove(_this.markers);
            _this.map.remove(_this.polylineArr);
            // 自动适配到合适视野范围
            // 无参数，默认包括所有覆盖物的情况
            _this.map.setFitView();
          }else{
            _this.userMarker = null;
            var AMap_timer = setInterval(function(){
              if(AMap){
                clearInterval(AMap_timer);
                _this.createMap();
              }
            },100);
          }
          _this.markers = [];
          _this.polylineArr = [];
          _this.getInit();
        }
    },
    beforeRouteLeave(to, from, next) {
        this.stopGeolocation();
        var dataList = [];
        this.days.forEach(v=>{
          if(v.active){
            dataList.push(v.mc);
          }
        });
        var list_update = {
          title:this.title,
          dianwei:this.dwxx_list.length,
          dataList:dataList,
          time1:this.time1,
          time2:this.time2,
          time3:this.time3,
          time4:this.time4
        };
        localStorage.setItem("list_update",JSON.stringify(list_update));
        next();
    },
    //进入该页面时
    beforeRouteEnter (to, from, next) {
        next(vm => {
          vm.init();
        })
    },
    mounted() {
      var _this = this;
      //this.init();

      //物理返回
      // window.addEventListener("popstate", function(){
      //   _this.getBack();
      // }, false);
    },
    created() {

    }
  };
</script>
<style scoped>
  /*整个页面*/
  * {
  	padding: 0;
  	margin: 0;
  	font-family: "华文黑体", "Arial", "微软雅黑", "黑体", "思源黑体";
  	font-size: 0.3888888888888889rem;
  }
  #main{
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
  }

  /* 导航 */
  .header {
    height: 1.8519rem;
    background: #007aff;
    padding-top: 0.8333rem;
    box-sizing: border-box;
    width: 100%;
    z-index: 20;
    font-size: 0.388888rem;
  }
  .title {
    padding: 0 0.3704rem;
    display: flex;
    align-items: center;
    color: #fff;
  }
  .title>div {
    width: 100%;
    font-size: 0.4444rem;
    text-align: center;
  }
  .img_zuo {
    width: 0.2593rem;
    height: 0.463rem;
  }


  /* 地图 */
  #ditu {
  	height: 7rem;
  	width: 100%;
  }

  /* 面板 */
  .panel {
  	width: 100%;
  	background-color: #FFFFFF;
  	display: flex;
  	/* flex-direction: column; */
  	font-size: 0.388888rem;
  	overflow-y: auto;
  	flex-wrap: wrap;
  	box-sizing: border-box;
    flex: 1;
  }

  /* 表单 */
  .panel-item {
  	width: 100%;
  	height: 1.3889rem;
  	display: flex;
  	align-items: center;
  	border-bottom: 1px #eeeeee solid;
  }

  .panel-item .left {
  	width: 1.574074rem;
  	/* height: 100%; */
  	margin-left: 0.37037rem;
  	display: flex;
  	align-items: center;
  	justify-content: flex-start;
  }

  .panel-item .right {
  	flex: 1;
  	/* height: 100%; */
  	display: flex;
  	align-items: center;
  	justify-content: flex-end;
  }

  .panel-item .right .create-btn {
  	width: 1.907407rem;
  	height: 0.74074rem;
  	margin-right: 0.37037rem;
  	background-color: #2c61fe;
  	color: #FFFFFF;
  	border-radius: 0.925925rem;
  	font-size: 0.388888rem;
  }

  .panel-item .right input {
  	flex: 1;
  	height: auto;
  	margin-right: 0.37037rem;
  	margin-left: 0;
  	margin-top: 0;
  	margin-bottom: 0;
  	padding-right: 0.185185rem;
  	text-align: right;
  	border: none;
  	padding-bottom: 0;
  	padding-top: 0;
  	padding-left: 0;
  }

  .panel .panel-select input {
  	margin-right: 0;
  }

  .panel .panel-select img {
  	width: 0.185185rem;
  	height: 0.342592rem;
  	margin-right: 0.555555rem;
  }

  /* 星期选择器 */
  .day-selector {
  	width: 100%;
  	height: 1.259259rem;
  	display: flex;
  	background-color: #f2f2f2;
  	align-items: flex-end;
  }

  .day-selector .day-item {
  	flex: 1;
  	height: 1.111111rem;
  	background-color: #7ac0fe;
  	color: #FFFFFF;
  	display: flex;
  	align-items: center;
  	justify-content: center;
  }

  .day-selector .active {
  	background-color: #2c61fe;
  }




  /* 按钮 */
  .btns {
  	width: 100%;
  	display: flex;
  	justify-content: space-around;
  	background-color: #f2f2f2;
  }

  .btns .btn {
  	border: 1px #2b6cfe solid;
  	height: 1.074074rem;
  	margin-top: 0.37037rem;
  	margin-bottom: 1rem;
  	flex: 1;
  	margin-left: 0.37037rem;
  	border-radius: 0.148148rem;
  	display: flex;
  	align-items: center;
  	justify-content: center;
  	font-size: 0.388888rem;
  	background-color: #2b6cfe;
  	color: #FFFFFF;
  }

  .btns .btn:last-child {
  	margin-right: 0.37037rem;
  }


  /* 弹框 */
  .tk{
  	width: 100%;
  	height: 100vh;
  	position: fixed;
  	top: 0;
  	left: 0;
  	z-index: 100;
  	display: flex;
  	align-items: center;
  	justify-content: center;
  }
  .tk-hide{
  	display: none !important;
  }
  .tk .bg {
  	background: rgba(0, 0, 0, 0.4);
  	width: 100%;
  	height: 100vh;
  	position: fixed;
  	top: 0;
  	left: 0;
  	z-index: 101;
  }
  .tk .tk-box{
  	width: 8.333333rem;
  	height: auto;
  	background-color: #FFFFFF;
  	z-index: 102;
  	border-radius: 0.222222rem;
  }
  .tk .tk-item{
  	width: auto;
  	height: 1.388888rem;
  	display: flex;
  	align-items: center;
  	justify-content: center;
  	border-bottom: 1px #DDDDDD solid;
  	margin-left: 0.333333rem;
  	margin-right: 0.333333rem;
  }
  .tk .tk-item .left{
  	width: 3.8rem;
  	height: 100%;
  	display: flex;
  	align-items: center;
  	justify-content: flex-start;
  }
  .tk .tk-item .left img{
  	width: 0.574074rem;
  	height: 0.777777rem;
  	margin-right: 0.185185rem;
  }
  .tk .tk-item .right{
  	flex: 1;
  	height: 100%;
  	display: flex;
  	align-items: center;
  	justify-content: flex-end;
  }

  .tk .tk-item .right img{
  	width: 0.444444rem;
  	height: 0.444444rem;
  }
  .tk .tk-item .right input{
  	width: 100%;
  	height: 100%;
  	border: none;
  	margin: 0;
  	padding: 0;
  	text-align: left;
  }
  .tk .tk-item .close{
  	width: 0.37037rem;
  	height: 0.37037rem;
  }

  /* 按钮 */
  .tk-btns{
  	width: auto;
  	display: flex;
  	justify-content: space-around;
  	margin-left: 0.37037rem;
  	margin-right: 0.37037rem;
  }
  .tk-btns .tk-btn{
  	border: 1px #2b6cfe solid;
  	height: 1.074074rem;
  	margin-top: 0.37037rem;
  	margin-bottom: 0.37037rem;
  	width: 100%;
  	border-radius: 0.148148rem;
  	display: flex;
  	align-items: center;
  	justify-content: center;
  	font-size: 0.388888rem;
  	margin-right: 0.37037rem;
  }
  .tk-btns .tk-btn:last-child{
  	margin-right: 0 !important;
  }

  /*新增点位弹框*/
  .zjdw-tk .tk-btn{
  	background-color: #2b6cfe;
  	color: #FFFFFF;
  	width: 3.703703rem !important;
  }

  /*更改点位弹框*/
  .ggdw-tk .tk-item .left{
  	flex: 1;
  }
  .ggdw-tk .tk-item .right{
  	width: 1rem;
  	flex: none !important;
  }
  .ggdwxx-tk .btn-qrxg{
  	background-color: #2b6cfe;
  	color: #FFFFFF;
  }
  .ggdwxx-tk .btn-show-del{
  	color: #2b6cfe;
  }
  .ggdwxx-tk .btn-gxdw{
  	border: 1px #7cd1fe solid;
  	background-color: #7cd1fe;
  	color: #FFFFFF;
  }
  .ggdwxx-tk .tk-btns{
  	flex-direction: column;
  	border-bottom: 1px #DDDDDD solid;
  }
  .ggdwxx-tk .tk-btns:last-child{
  	border-bottom: none;
  }
  .ggdwxx-tk .tk-btn{
  	margin-top: 0 !important;
  }
  .ggdwxx-tk .tk-btn:first-child{
  	margin-top: 0.37037rem !important;
  }

  /* 删除提示弹框 */
  .del-tk{
  	z-index: 110 !important;
  }
  .del-tk .bg{
  	z-index: 111 !important;
  }
  .del-tk .tk-box{
  	z-index: 112 !important;
  	width: 7.037037rem !important;
  }
  .del-tk .tk-nr{
  	margin-left: 0.37037rem;
  	margin-right: 0.37037rem;
  	width: auto;
  }
  .del-tk .tk-btn{
  	background-color: #2b6cfe;
  	color: #FFFFFF;
  }
  /* 删除提示弹框 */
  .no-del-tk{
  	z-index: 110 !important;
  }
  .no-del-tk .bg{
  	z-index: 111 !important;
  }
  .no-del-tk .tk-box{
  	z-index: 112 !important;
  	width: 7.037037rem !important;
  }
  .no-del-tk .tk-item:last-child{
  	height: 2rem !important;
  }
  .no-del-tk .tk-nr{
  	margin-left: 0.37037rem;
  	margin-right: 0.37037rem;
  	width: auto;
  }
  .no-del-tk .tk-btn{
  	background-color: #2b6cfe;
  	color: #FFFFFF;
  }

  /*修改设置弹框*/
  .xgsz-tk .btn-xgsz-qrxg{
  	background-color: #2b6cfe;
  	color: #FFFFFF;
  }

  /* 时间选择器 */
  .date-piker {
  	margin-top: 0.222222rem;
  	margin-bottom: 0.222222rem;
  	display: flex;
  	/* padding: 0 1.5rem; */
  	padding: 0 0.3704rem;
  	justify-content: center;
  	width: 100%;
  	align-items: center;
  }

  .date-piker button {
  	width: 3.351851rem;
  	height: 1.074074rem;
  	display: flex;
  	align-items: center;
  	justify-content: space-between;
  	border-radius: 0.925925rem;
    border: 0.009259rem solid #ccc;
  }

  .date-piker button span {
  	margin-left: 0.648148rem;
  }

  .date-piker button img {
  	width: 0.462962rem;
  	height: 0.462962rem;
  	margin-right: 0.166666rem;
  }

  .date-piker .line {
  	flex: 1;
  	height: 1.074074rem;
  	display: flex;
  	align-items: center;
  	justify-content: center;
  	font-size: 0.25rem;
  	color: #7d7d7d;
  }

  .date-piker-btn {
  	width: 2.055555rem;
  	height: 1.074074rem;
  	background-color: #2c61fe;
  	color: #FFFFFF;
  	border-radius: 0.925925rem;
  	font-size: 0.388888rem;
  	margin-right: 0.074074rem;
  	margin-left: 0.148148rem;
  }
  .date-wz{
    margin-right: 0.185185rem;
  }

  .xgsz-tk .date-piker{
    width: auto !important;
  }
  .xgsz-tk .date-piker button{
    width: 2.5rem !important;
    border: 0.009259rem solid #ccc !important;
  }
  .xgsz-tk .date-piker button img{
    margin-left: 0.185185rem !important;
  }
  .xgsz-tk #lb input{
  	text-align: right !important;
  }

  .top_tk{
    z-index: 110;
  }

</style>
